<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- <script>

        var obj = {
            name: "MrDeng",
            age: 40,
            sex: "male",
            health: 100,
            smoke: function() {  
                console.log('I am smoking! cool!!');
                obj.health --; // 函数执行创建自己的AO。
                // 然后去GO里面找health，然而GO里面只有obj对象，所以要使用obj.health
            },
            drink: function() {
                console.log('I am drinking!');
                this.health ++; // this像是第一人称，指代，后面讲
            }
        }
        // 数组其实就是另一种类型的对象，使用0-arr.length来索引


        // 属性的增加
        obj.wife = 'xiaoliu';

        var res = obj.a;//返回undefined，并不会增加属性a

        // 查看属性
        console.log(obj.age);
        document.write(obj);//展示数据使用控制台
        // 打印出[object Object]

        // 改
        obj.age = 35;
        console.log(obj);


        // 删除
        delete obj.sex;  //该语句会返回true
    </script> -->

    <script>

        var deng = {
            prepareWife: 'xiaowang',
            name: 'laodeng',
            sex: 'male',
            gf: "xiaoliu",
            wife: "",
            divorce: function() {
                delete this.wife;
                this.gf = this.prepareWife;
            },
            getMarried: function() {
                this.wife = this.gf;
            },
            changePrepareWife: function(someone) {
                this.prepareWife = someone;
            }
        }


    </script>
</body>
</html>